package com.freecloud.javabasics.javap;

/**
 * 静态分配
 * @Author: maomao
 * @Date: 2019-11-05 09:21
 */
public class StaticAllocated {

    static class Super{}

    static class Sub1 extends Super{}

    static class Sub2 extends Super{}

    public void test(Sub1 sub){
        System.out.println("sub1 ");
    }

    public void test(Sub2 sub){
        System.out.println("sub2 ");
    }

    public void test(Super sup){
        System.out.println("super");
    }

    public static void main(String[] args) {
        Super c1 = new Sub1();
        Super c2 = new Sub2();

        StaticAllocated s = new StaticAllocated();
        s.test(c1);
        s.test(c2);
        s.test((Sub1) c1);
    }
}
